
using Youz.Common.Entity;
using Youz.Common.Helper;
using Youz.CreditRepay.DAL;
using Youz.CreditRepay.Entity;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

namespace Youz.CreditRepay.BLL
{
	/// <summary>
	/// Sys_CorporateAccounts BLL Class
	/// </summary>
	public partial class Sys_CorporateAccountsBLL : BaseBLL
	{
		Sys_CorporateAccountsDAL dal;
		
		public Sys_CorporateAccountsBLL()
		{
			dal = new Sys_CorporateAccountsDAL();
			base.ModuleName = "Sys_CorporateAccounts";
			base.MenuName = "Sys_CorporateAccounts";
		}

		#region  成员方法
		/// <summary>
		///  新增一条数据
		/// </summary>
		public bool Add(Sys_CorporateAccounts model)
		{
			var r = dal.Add(model);
			
			base.WriteOperationLog(OperationType.Add, r, Core.GetJsonByObjectHaveTime(model));

			return r;
		}

		/// <summary>
		///  保存一条数据
		/// </summary>
		public bool Update(Sys_CorporateAccounts model)
		{
			var r = dal.Update(model);
			
			base.WriteOperationLog(OperationType.Update, r, Core.GetJsonByObjectHaveTime(model));

			return r;
		}

		/// <summary>
		/// 删除一条数据
		///</summary>
		public bool Delete(Guid AccountsId)
		{
			var r = dal.Delete(AccountsId);
			
			base.WriteOperationLog(OperationType.Delete, r, AccountsId);

			return r;
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Sys_CorporateAccounts Get(Guid AccountsId)
		{
			return dal.Get(AccountsId);
		}
		
		/// <summary>
		/// 得到一个JSON对象
		/// </summary>
		public string GetJson(Guid AccountsId)
		{
			return Core.GetJsonByObject(Get(AccountsId));
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet Gets(string sqlWhere)
		{
			return dal.Gets(sqlWhere);
		}
		
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet Gets(int top, string sqlWhere, string filedOrder)
		{
			return dal.Gets(top, sqlWhere, filedOrder);
		}
		
		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string sqlWhere)
		{
			return dal.GetRecordCount(sqlWhere);
		}
		
		/// <summary>
		/// 获得数据列表分页
		/// </summary>
		public DataTable Gets(string sqlWhere, int pageindex, int pagesize, out int total, params SqlParameter[] cmdParms)
		{
			return dal.Gets(sqlWhere, pageindex, pagesize, out total, cmdParms);
		}
		#endregion  成员方法

        /// <summary>
        /// 获取公司收款账户
        /// </summary>
        /// <returns></returns>
        public List<Sys_CorporateAccounts> GetCorporateAccounts()
        {
            List<Sys_CorporateAccounts> list;
            string json = Core.GetJsonByObject(dal.GetCorporateAccounts());
            list = JsonConvert.DeserializeObject<List<Sys_CorporateAccounts>>(json);
            return list;
        }

	}
}


  